﻿using System;
using System.Net;
using System.ComponentModel;
using System.Linq.Expressions;

namespace SL8.SL.Data
{
    public class SearchCondition<T>
    {
        private SortDescription[] _sortDescriptions = null;
        private int _pageIndex = 0;
        private int _pageSize = -1;
        private Expression<Func<T, bool>> _conditionExpression;
        public SortDescription[] SortDescriptions
        {
            get
            {
                return this._sortDescriptions;
            }

            private set
            {
                this._sortDescriptions = value;
            }
        }

        public int PageIndex
        {
            get
            {
                return this._pageIndex;
            }

            private set
            {
                this._pageIndex = value;
            }
        }

        public int PageSize
        {
            get
            {
                return this._pageSize;
            }

            private set
            {
                this._pageSize = value;
            }
        }

        public Expression<Func<T, bool>> ConditionExpression
        {
            get
            {
                return this._conditionExpression;
            }

            private set
            {
                this._conditionExpression = value;
            }
        }

        public SearchCondition(Expression<Func<T, bool>> conditionExpression = null, SortDescription[] sortDescriptions = null, int pageIndex = 0, int pageSize = -1)
        {
            this.SortDescriptions = sortDescriptions;
            this.ConditionExpression = conditionExpression;
            this.PageIndex = pageIndex;
            this.PageSize = pageSize;
        }
    }

    //public class SearchCondition : SearchCondition<object>
    //{
    //    public SearchCondition(Expression<Func<object, bool>> conditionExpression, SortDescription[] sortDescriptions, int pageIndex, int pageSize) :
    //        base(conditionExpression, sortDescriptions, pageIndex, pageSize)
    //    { }
    //}
}
